//
//  logDelegate.h
//  TcpTest_Server
//
//  Created by scarlettsun on 12-7-27.
//  Copyright (c) 2012年 tencent. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "GCDAsyncSocket.h"
#import "SockPacket.h"
#import "PacketDispatchCenter.h"

#define LENGTH  sizeof(NSUInteger)

enum ReadMode {Readlenth = 0,ReadContent =1 };

@interface MiniSocket : NSObject<GCDAsyncSocketDelegate>
{
    /*read state，Readlenth---read length ReadContent--- read content；*/
     enum ReadMode readMode; 
    
    /*data lenth;*/
    NSUInteger packetLength; 
    
    /*data buffer;*/
    NSMutableData *buffer; 
    
    /*user QQnum  if userId == 0  havnt received loggin info*/
    NSUInteger userId;
    
    /* 用户的监听端口 */
    NSInteger listenPort;
    
    PacketDispatchCenter *packetDispatchCenter;
}

@property GCDAsyncSocket * miniAsynSocket;
@property NSUInteger userId;
@property NSInteger listenPort;

/**/
-(MiniSocket *) initWithSock:(GCDAsyncSocket *)sock;

@end
